import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './components/home/home.component';
import { ProductComponent } from './components/product/product.component';
import { WelcomeComponent } from './components/home/welcome/welcome.component';
import { SettingComponent } from './components/home/setting/setting.component';
import { CategoryComponent } from './components/product/category/category.component';
import { ListComponent } from './components/product/list/list.component';
import { NewsComponent } from './components/news/news.component';

const routes: Routes = [
  {
    path:'home', component: HomeComponent,

    children:[
      {path:'welcome', component: WelcomeComponent},
      {path:'setting', component: SettingComponent},
      {path:'**',  redirectTo:'welcome'}
    ]

  },
  {
    path:'product', component: ProductComponent,

    children:[
      {path:'category', component: CategoryComponent},
      {path:'list', component: ListComponent},
      {path:'**',  redirectTo:'category'}
    ]
  },
  {path:'news', component:NewsComponent},
  {
    path:'**', redirectTo:'home'
  }
  


];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
